<?php
if (!defined('IN_PROVERB')) {
    exit ('Access Denied');
}

class admin
{
    static $filelist = array();

    function main_action()
    {
        global $db, $session;
        $uid = $session->get('adminid');
        //得到个人信息
        $userinfo = $db->fetch_first('select * from ' . tname('admin') . ' where uid=' . $uid);
        include ROOT_PATH . '/views/admin/adminframe.php';
    }

    function index_action()
    {
        include ROOT_PATH . '/views/admin/index.php';
    }

    function login_action()
    {

        if (submitcheck('commit')) {
            $user = global_addslashes(trim(strip_tags($_POST ['username'])));
            $password = md52($_POST ['password']);
            $container = ' and username="' . $user . '" and passwd="' . $password . '" and usertype="adminuser"';

            $user_mod = new common ('admin');
            $userinfo = $user_mod->GetOne($container);

            if ($userinfo) {
                $GLOBALS ['session']->set('adminid', $userinfo ['uid']);
                $GLOBALS ['session']->set('adminuser', $userinfo ['username']);
                echo '<SCRIPT LANGUAGE="JavaScript">
				<!--
					window.onload=function(){window.open("index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '","_top","")};
				//-->
				</SCRIPT>';
            } else {
                exit ('<SCRIPT LANGUAGE="JavaScript">
				<!--
					alert("用户名或密码不正确!");
					parent.document.getElementById("user_pass").value="";
				//-->
				</SCRIPT>');
            }
        } else {
            include ROOT_PATH . '/views/admin/login.php';
        }
    }

    function logout_action()
    {
        $GLOBALS ['session']->del(array('adminid', 'adminuser'));

        sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=login');
    }

    //后台系统变量
    function setting_action()
    {

        $type = $_GET ['type'];
        switch ($type) {
            case 'site' :
                include ROOT_PATH . '/views/admin/setting_site.php';
                break;
            default :
                include ROOT_PATH . '/views/admin/setting_site.php';
                break;
        }
    }

    //处理系统提交数据
    function settingdata_action()
    {
        if (submitcheck('commit')) {
            unset($_POST['con']);
            unset($_POST['act']);
            $type = $_POST ['dotype'];
            unset ($_POST ['commit'], $_POST ['dotype']);

            $setting_mod = new common ('setting');

            if ($_FILES ['site_logo'] ['name']) {
                $filename = explode('.', $_FILES ['site_logo'] ['name']);
                $container = 'and variable="site_logo"';
                $data ['content'] = _upload('site_logo', 'data/logo', 'logo.' . $filename [1]);
                $datalist = $setting_mod->GetOne($container);

                if ($datalist) {
                    $setting_mod->UpdateData($data, $container);
                } else {
                    $data ['variable'] = 'site_logo';
                    $setting_mod->InsertData($data);
                }
            }
            $changeadmin = '';
            foreach ($_POST as $k => $v) {
                if ($k == 'adminpath' && $v != $GLOBALS['setting']['adminpath']) {
                    $changeadmin = $v;
                }
                $container = 'and variable="' . $k . '"';
                $data ['content'] = strip_tags($v);
                $datalist = $setting_mod->GetOne($container);
                if ($datalist) {
                    $updatesql [$k] = $v;
                } else {
                    $insertsql [$k] = $v;
                }
            }

            if ($insertsql) {
                foreach ($insertsql as $key => $val) {
                    $setting_mod->InsertData(array('variable' => $key, 'content' => $val));
                }
            }
            if ($updatesql) {
                foreach ($updatesql as $key => $val) {
                    $setting_mod->UpdateData(array('content' => $val), 'and variable="' . $key . '"');
                }
            }
            if ($type == 'template') {
                $dofile = cleancache('', 'data/compile');
                if (!$dofile) {
                    echo '<SCRIPT LANGUAGE="JavaScript">
					<!--
						alert("模板更新成功,清空系统编译失败,请手动清除");
					//-->
					</SCRIPT>';
                } else {
                    echo '<SCRIPT LANGUAGE="JavaScript">
					<!--
						alert("模板更新成功");
					//-->
					</SCRIPT>';
                }
            }
            deletef('setting');

            if (!empty($changeadmin)) {
                echo '后台路径参数已修改，为了系统安全，请您继续做以下工作：<ul><li>1、连接ftp,将controls/' . $GLOBALS['setting']['adminpath'] . '.class.php文件名修改为:' . $changeadmin . '.class.php</li><li>2、打开' . $changeadmin . '.class.php，将文件中' . $GLOBALS['setting']['adminpath'] . '_controller替换为:' . $changeadmin . '_controller</li><li>3、修改完毕后,<a href="' . SITE_ROOT . '/?con=' . $changeadmin . '" target="_top">重新进入后台</a></li></ul>';
            } else {
                if ($_REQUEST ['custom_url']) {
                    sheader($_REQUEST ['custom_url'], 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=setting&type=' . $type, 3, '修改成功', 'redirect', true);
                }
            }
        }
    }


    //清空缓存
    function delcache_action()
    {
        $dofile = cleancache();
        if ($dofile === 'nowrite') {
            echo '<SCRIPT LANGUAGE="JavaScript">
			<!--
				parent.showDiglog("' . $GLOBALS['setting']['site_cache_dir'] . '目录修改权限不足,请联系服务商");
			//-->
			</SCRIPT>';
        } elseif (!$dofile) {
            echo '<SCRIPT LANGUAGE="JavaScript">
			<!--
				parent.showDiglog("清空缓存失败,请在ftp上手动清除");
			//-->
			</SCRIPT>';
        } else {

            cleancache('php', 'data/cache/userinfo');
            cleancache('php', 'data/cache/usercount');
            echo '<SCRIPT LANGUAGE="JavaScript">
			<!--
				parent.showDiglog("清空缓存成功");
			//-->
			</SCRIPT>';
        }
    }

    //管理员列表
    function manageuser_action()
    {
        $ext = '';
        $container = '';
        if ($_REQUEST ['username']) {
            $container .= ' and username like "%' . global_addslashes($_REQUEST ['username']) . '%"';
            $ext = '&username=' . $_REQUEST ['username'];
        }

        $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST ['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=admin' . $ext, 'example' => 3);
        $user_mod = new common ('admin');
        $userlist = $user_mod->GetPage($showpage, $container);


        include ROOT_PATH . '/views/admin/manageuser.php';
    }

    /**
     *添加会员
     */
    function manageusermodify_action()
    {

        $updateid = intval($_REQUEST ['updateid']);
        $user_mod = new common ('admin');
        $user = array();
        if (submitcheck('commit')) {

            $data ['username'] = trim(strip_tags($_POST ['username']));
            $data ['usertype'] = "adminuser";
            $data ['email'] = trim(strip_tags($_POST ['email']));

            $author ['username'] = $data ['username'];
            $author ['urlname'] = Pinyin($data ['username']);
            $author ['email'] = $data ['email'];
            $author ['created_at'] = time();
            $author ['location'] = "";

            if ($updateid > 0) {

                $user = $user_mod->GetOne('and uid=' . $updateid);

                if (!empty ($_POST ['password'])) {
                    $data ['passwd'] = md52($_POST ['password']);
                    $author ['passwd'] = $data ['passwd'];
                }
                if ($user_mod->UpdateData($data, 'and uid=' . $updateid)) {

                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=manageuser&type=manageuser', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=manageuser&type=manageuser', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['passwd'] = md52($_POST ['password']);
                $author ['passwd'] = $data ['passwd'];
                $user_mod->InsertData($data);
                sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=manageuser&type=manageuser', 3, '添加成功', 'redirect', true);
            }
        } else {
            if ($updateid) {
                $user_mod->GetOne('and uid=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/manageuser_form.php';
        }
    }

    //党员管理
    function dangyuanjf_action()
    {
        $data_mod = new common('user');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'passUser' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'refuseUser' && $id > 0) {
            $data ['isused'] = 2;
            $data_mod->UpdateData($data, 'and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改成功', 'redirect', true);
        } else {
            $container = " and user_type=0";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and user_type=0 and user_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=dangyuan', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY jifen DESC, user_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $projectGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $projectGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $projectGroup;
            }
            include ROOT_PATH . '/views/admin/dangyuanjf.php';
        }
    }

    //党员管理
    function dangyuan_action()
    {
        $data_mod = new common('user');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'passUser' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'refuseUser' && $id > 0) {
            $data ['isused'] = 2;
            $data_mod->UpdateData($data, 'and user_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改成功', 'redirect', true);
        } else {
            $container = " and user_type=0";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and user_type=0 and user_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=dangyuan', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY isused ASC, user_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $projectGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $projectGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $projectGroup;
            }
            include ROOT_PATH . '/views/admin/dangyuan.php';
        }
    }

    function dangyuanmodify_action()
    {
        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $dangyuan_mod = new common ('user');
        if (submitcheck('commit')) {

            $data ['gangwei'] = $_POST['gangwei'];
            $data ['gid'] = $_POST['gid'];
            $data ['jifen'] = $_POST['jifen'];
            $data ['user_name'] = $_POST['user_name'];


            if ($updateid > 0) {
                if ($dangyuan_mod->UpdateData($data, 'and user_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuan', 3, '修改失败', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $dangyuan = $dangyuan_mod->GetOne('and user_id=' . $updateid);
                $gangwei = getAllGangweis();
            }
            include ROOT_PATH . '/views/admin/dangyuan_form.php';
        }
    }

    /**
     * 岗位管理
     */
    function gangwei_action()
    {
        $data_mod = new common('gangwei');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and gid=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and gid=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and gid=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and gname like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=gangwei', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY gid DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $gangweiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $gangweiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $gangweiGroup;
            }
            include ROOT_PATH . '/views/admin/gangwei.php';
        }
    }

    /**
     *添加岗位
     */

    function gangweimodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $gangwei_mod = new common ('gangwei');
        if (submitcheck('commit')) {

            $data ['gname'] = $_POST['gname'];


            if ($updateid > 0) {
                if ($gangwei_mod->UpdateData($data, 'and gid=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($gangwei_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gangwei', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $gangwei = $gangwei_mod->GetOne('and gid=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/gangwei_form.php';
        }
    }

    //标签管理
    function media_action()
    {
        $data_mod = new common('xuexi');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=media', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $mediaGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $mediaGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $mediaGroup;
            }
            include ROOT_PATH . '/views/admin/media.php';
        }
    }


    /**
     *添加标签
     */

    function mediamodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $media_mod = new common ('xuexi');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($media_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($media_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=media', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $media = $media_mod->GetOne('and topic_id=' . $updateid);
                $media['file'] = $file_mod->GetOne('and file_id=' . $media['file_id']);
            }
            include ROOT_PATH . '/views/admin/media_form.php';
        }
    }

    //标签管理
    function news_action()
    {
        $data_mod = new common('news');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=news', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $newsGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $newsGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $newsGroup;
            }
            include ROOT_PATH . '/views/admin/news.php';
        }
    }

    /**
     *添加标签
     */

    function newsmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $news_mod = new common ('news');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($news_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($news_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=news', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $news = $news_mod->GetOne('and topic_id=' . $updateid);
                $news['file'] = $file_mod->GetOne('and file_id=' . $news['file_id']);
            }
            include ROOT_PATH . '/views/admin/news_form.php';
        }
    }

    //标签管理
    function xuexi_action()
    {
        $data_mod = new common('xuexi');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=xuexi', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $xuexiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $xuexiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $xuexiGroup;
            }
            include ROOT_PATH . '/views/admin/xuexi.php';
        }
    }

    /**
     *添加标签
     */

    function xueximodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $xuexi_mod = new common ('xuexi');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_time'] = $_POST['topic_time'];
            $data ['topic_type'] = $_POST['topic_type'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($xuexi_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($xuexi_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xuexi', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $xuexi = $xuexi_mod->GetOne('and topic_id=' . $updateid);
                $xuexi['file'] = $file_mod->GetOne('and file_id=' . $xuexi['file_id']);
            }
            include ROOT_PATH . '/views/admin/xuexi_form.php';
        }
    }

    //标签管理
    function shici_action()
    {
        $data_mod = new common('shici');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=shici', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $shiciGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $shiciGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $shiciGroup;
            }
            include ROOT_PATH . '/views/admin/shici.php';
        }
    }

    /**
     *添加标签
     */

    function shicimodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $shici_mod = new common ('shici');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($shici_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($shici_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=shici', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $shici = $shici_mod->GetOne('and topic_id=' . $updateid);
                $shici['file'] = $file_mod->GetOne('and file_id=' . $shici['file_id']);
            }
            include ROOT_PATH . '/views/admin/shici_form.php';
        }
    }

    //标签管理
    function erxueyizuo_action()
    {
        $data_mod = new common('erxueyizuo');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=erxueyizuo', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $erxueyizuoGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $erxueyizuoGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $erxueyizuoGroup;
            }
            include ROOT_PATH . '/views/admin/erxueyizuo.php';
        }
    }

    /**
     *添加标签
     */

    function erxueyizuomodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $erxueyizuo_mod = new common ('erxueyizuo');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($erxueyizuo_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($erxueyizuo_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=erxueyizuo', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $erxueyizuo = $erxueyizuo_mod->GetOne('and topic_id=' . $updateid);
                $erxueyizuo['file'] = $file_mod->GetOne('and file_id=' . $erxueyizuo['file_id']);
            }
            include ROOT_PATH . '/views/admin/erxueyizuo_form.php';
        }
    }


    //标签管理
    function rudang_action()
    {
        $data_mod = new common('rudang');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=rudang', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $rudangGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $rudangGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $rudangGroup;
            }
            include ROOT_PATH . '/views/admin/rudang.php';
        }
    }

    /**
     *添加标签
     */

    function rudangmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $rudang_mod = new common ('rudang');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($rudang_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($rudang_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=rudang', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $rudang = $rudang_mod->GetOne('and topic_id=' . $updateid);
                $rudang['file'] = $file_mod->GetOne('and file_id=' . $rudang['file_id']);
            }
            include ROOT_PATH . '/views/admin/rudang_form.php';
        }
    }

    //标签管理
    function gonggao_action()
    {
        $data_mod = new common('gonggao');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=gonggao', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $gonggaoGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $gonggaoGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $gonggaoGroup;
            }
            include ROOT_PATH . '/views/admin/gonggao.php';
        }
    }

    /**
     *添加标签
     */

    function gonggaomodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $gonggao_mod = new common ('gonggao');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($gonggao_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($gonggao_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gonggao', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $gonggao = $gonggao_mod->GetOne('and topic_id=' . $updateid);
                $gonggao['file'] = $file_mod->GetOne('and file_id=' . $gonggao['file_id']);
            }
            include ROOT_PATH . '/views/admin/gonggao_form.php';
        }
    }

    //标签管理
    function fengcai_action()
    {
        $data_mod = new common('fengcai');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=fengcai', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $fengcaiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $fengcaiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $fengcaiGroup;
            }
            include ROOT_PATH . '/views/admin/fengcai.php';
        }
    }

    /**
     *添加标签
     */

    function fengcaimodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $fengcai_mod = new common ('fengcai');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($fengcai_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($fengcai_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=fengcai', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $fengcai = $fengcai_mod->GetOne('and topic_id=' . $updateid);
                $fengcai['file'] = $file_mod->GetOne('and file_id=' . $fengcai['file_id']);
            }
            include ROOT_PATH . '/views/admin/fengcai_form.php';
        }
    }

    //标签管理
    function sanhuiyike_action()
    {
        $data_mod = new common('sanhuiyike');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=sanhuiyike', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $sanhuiyikeGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $sanhuiyikeGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $sanhuiyikeGroup;
            }
            include ROOT_PATH . '/views/admin/sanhuiyike.php';
        }
    }

    /**
     *添加标签
     */

    function sanhuiyikemodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $sanhuiyike_mod = new common ('sanhuiyike');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($sanhuiyike_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($sanhuiyike_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sanhuiyike', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $sanhuiyike = $sanhuiyike_mod->GetOne('and topic_id=' . $updateid);
                $sanhuiyike['file'] = $file_mod->GetOne('and file_id=' . $sanhuiyike['file_id']);
            }
            include ROOT_PATH . '/views/admin/sanhuiyike_form.php';
        }
    }

    //标签管理
    function jingcaihuodong_action()
    {
        $data_mod = new common('jingcaihuodong');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=jingcaihuodong', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $jingcaihuodongGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $jingcaihuodongGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $jingcaihuodongGroup;
            }
            include ROOT_PATH . '/views/admin/jingcaihuodong.php';
        }
    }

    /**
     *添加标签
     */

    function jingcaihuodongmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $jingcaihuodong_mod = new common ('jingcaihuodong');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($jingcaihuodong_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($jingcaihuodong_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jingcaihuodong', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $jingcaihuodong = $jingcaihuodong_mod->GetOne('and topic_id=' . $updateid);
                $jingcaihuodong['file'] = $file_mod->GetOne('and file_id=' . $jingcaihuodong['file_id']);
            }
            include ROOT_PATH . '/views/admin/jingcaihuodong_form.php';
        }
    }

    //标签管理
    function jizhonghuodongri_action()
    {
        $data_mod = new common('jizhonghuodongri');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=jizhonghuodongri', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $jizhonghuodongriGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $jizhonghuodongriGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $jizhonghuodongriGroup;
            }
            include ROOT_PATH . '/views/admin/jizhonghuodongri.php';
        }
    }

    /**
     *添加标签
     */

    function jizhonghuodongrimodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $jizhonghuodongri_mod = new common ('jizhonghuodongri');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($jizhonghuodongri_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($jizhonghuodongri_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=jizhonghuodongri', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $jizhonghuodongri = $jizhonghuodongri_mod->GetOne('and topic_id=' . $updateid);
                $jizhonghuodongri['file'] = $file_mod->GetOne('and file_id=' . $jizhonghuodongri['file_id']);
            }
            include ROOT_PATH . '/views/admin/jizhonghuodongri_form.php';
        }
    }

    //标签管理
    function qianshouxingdong_action()
    {
        $data_mod = new common('qianshouxingdong');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=qianshouxingdong', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $qianshouxingdongGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $qianshouxingdongGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $qianshouxingdongGroup;
            }
            include ROOT_PATH . '/views/admin/qianshouxingdong.php';
        }
    }

    /**
     *添加标签
     */

    function qianshouxingdongmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $qianshouxingdong_mod = new common ('qianshouxingdong');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($qianshouxingdong_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($qianshouxingdong_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=qianshouxingdong', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $qianshouxingdong = $qianshouxingdong_mod->GetOne('and topic_id=' . $updateid);
                $qianshouxingdong['file'] = $file_mod->GetOne('and file_id=' . $qianshouxingdong['file_id']);
            }
            include ROOT_PATH . '/views/admin/qianshouxingdong_form.php';
        }
    }


    //标签管理
    function gongzuodongtai_action()
    {
        $data_mod = new common('gongzuodongtai');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'addUse' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '修改成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'delUse' && $id > 0) {
            $data ['isused'] = 0;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=gongzuodongtai', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $gongzuodongtaiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $gongzuodongtaiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $gongzuodongtaiGroup;
            }
            include ROOT_PATH . '/views/admin/gongzuodongtai.php';
        }
    }

    /**
     *添加标签
     */

    function gongzuodongtaimodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $gongzuodongtai_mod = new common ('gongzuodongtai');
        $file_mod = new common ('file');
        $tag = array();
        if (submitcheck('commit')) {


//              `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
//              `topic_name` varchar(20) NOT NULL COMMENT '文章名称',
//              `isused` tinyint(1) NOT NULL COMMENT '是否关闭',
//              `topic_desc` TEXT NOT NULL COMMENT '文章内容',
//              `topic_tag` varchar(20) NOT NULL COMMENT '话题标语',
//              `created_time`

            $data ['topic_name'] = $_POST['topic_name'];
            $data ['topic_desc'] = $_POST['topic_desc'];
            $data ['topic_intro'] = $_POST['topic_intro'];
            $data ['file_id'] = $_POST['file_id'];

            if (intval($data['file_id']) < 1)
                $data ['file_id'] = $_POST['tag_file_id'];


            if ($updateid > 0) {
                if ($gongzuodongtai_mod->UpdateData($data, 'and topic_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '修改失败', 'redirect', true);
                }
            } else {
                $data ['created_time'] = time();
                if ($gongzuodongtai_mod->InsertData($data)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=gongzuodongtai', 3, '添加成功', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $gongzuodongtai = $gongzuodongtai_mod->GetOne('and topic_id=' . $updateid);
                $gongzuodongtai['file'] = $file_mod->GetOne('and file_id=' . $gongzuodongtai['file_id']);
            }
            include ROOT_PATH . '/views/admin/gongzuodongtai_form.php';
        }
    }


    //标签管理
    function xiangshanghuibao_action()
    {
        $data_mod = new common('xiangshanghuibao');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xiangshanghuibao', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'view' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=xiangshanghuibao', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=xiangshanghuibao', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $xiangshanghuibaoGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $xiangshanghuibaoGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $xiangshanghuibaoGroup;
            }
            include ROOT_PATH . '/views/admin/xiangshanghuibao.php';
        }
    }


    //标签管理
    function sixianghuibao_action()
    {
        $data_mod = new common('sixianghuibao');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sixianghuibao', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'view' && $id > 0) {
            $data ['isused'] = 1;
            $data_mod->UpdateData($data, 'and topic_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=sixianghuibao', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and topic_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=sixianghuibao', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY topic_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $sixianghuibaoGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $sixianghuibaoGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $sixianghuibaoGroup;
            }
            include ROOT_PATH . '/views/admin/sixianghuibao.php';
        }
    }

    //标签管理
    function feedback_action()
    {
        $data_mod = new common('feedback');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and f_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=feedback', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'view' && $id > 0) {
            $data ['is_view'] = 1;
            $data_mod->UpdateData($data, 'and f_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=feedback', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and raw_text like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=feedback', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY f_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $feedbackGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $feedbackGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $feedbackGroup;
            }
            include ROOT_PATH . '/views/admin/feedback.php';
        }
    }


    /**
     *添加标签
     */

    function feedbackmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $media_mod = new common ('feedback');
        $tag = array();
        if (submitcheck('commit')) {

            $data ['raw_text_re'] = $_POST['raw_text_re'];
            $data ['is_view'] = 1;

            if ($updateid > 0) {
                if ($media_mod->UpdateData($data, 'and f_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=feedback', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=feedback', 3, '修改失败', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $feedback = $media_mod->GetOne('and f_id=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/feedback_form.php';
        }
    }

    //标签管理
    function weimengxiang_action()
    {
        $data_mod = new common('weimengxiang');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and f_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=weimengxiang', 3, '删除成功', 'redirect', true);
        } elseif ($_REQUEST['type'] == 'view' && $id > 0) {
            $data ['is_view'] = 1;
            $data_mod->UpdateData($data, 'and f_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=weimengxiang', 3, '修改成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and raw_text like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=weimengxiang', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY f_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $weimengxiangGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $weimengxiangGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $weimengxiangGroup;
            }
            include ROOT_PATH . '/views/admin/weimengxiang.php';
        }
    }


    /**
     *添加标签
     */

    function weimengxiangmodify_action()
    {

        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $media_mod = new common ('weimengxiang');
        $tag = array();
        if (submitcheck('commit')) {

            $data ['raw_text_re'] = $_POST['raw_text_re'];
            $data ['is_view'] = 1;

            if ($updateid > 0) {
                if ($media_mod->UpdateData($data, 'and f_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=weimengxiang', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=weimengxiang', 3, '修改失败', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $weimengxiang = $media_mod->GetOne('and f_id=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/weimengxiang_form.php';
        }
    }


    //标签管理
    function dangyuanfuwu_action()
    {
        $data_mod = new common('service');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and s_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanfuwu', 3, '删除成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and service_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=dangyuanfuwu', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY s_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $xuexiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $xuexiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $xuexiGroup;
            }
            include ROOT_PATH . '/views/admin/dangyuanfuwu.php';
        }
    }

    /**
     *添加标签
     */

    function dangyuanfuwumodify_action()
    {
        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $media_mod = new common ('service');
        $tag = array();
        if (submitcheck('commit')) {

            $data ['service_yijian'] = $_POST['service_yijian'];
            $data ['admin_ping'] = $_POST['admin_ping'];
            $data ['admin_ping_num'] = $_POST['admin_ping_num'];

            if ($updateid > 0) {
                if ($media_mod->UpdateData($data, 'and s_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanfuwu', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanfuwu', 3, '修改失败', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $dangyuanfuwu = $media_mod->GetOne('and s_id=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/dangyuanfuwu_form.php';
        }
    }

    //标签管理
    function dangyuanxuqiu_action()
    {
        $data_mod = new common('need');
        $id = intval($_REQUEST['id']);
        if ($_REQUEST['type'] == 'del' && $id > 0) {
            $data_mod->DeleteData('1 and n_id=' . $id);
            sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanxuqiu', 3, '删除成功', 'redirect', true);
        } else {
            $container = "";
            if (!empty($_REQUEST['keyword'])) {
                $container .= ' and need_name like "%' . trim(strip_tags($_REQUEST['keyword'])) . '%"';
            }
            $showpage = array('isshow' => 1, 'currentpage' => intval($_REQUEST['page']), 'pagesize' => 20, 'url' => 'index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=dangyuanxuqiu', 'example' => 2);
            $taglist = $data_mod->GetPage($showpage, $container, "", "", "ORDER BY n_id DESC");
            $dataCount = count($taglist['data']);
            if ($dataCount > 0) {
                $xuexiGroup = array();
                for ($i = 0; $i < $dataCount; $i++) {
                    $xuexiGroup[] = $taglist['data'][$i];
                }
                $taglist['data'] = $xuexiGroup;
            }
            include ROOT_PATH . '/views/admin/dangyuanxuqiu.php';
        }
    }

    /**
     *添加标签
     */

    function dangyuanxuqiumodify_action()
    {
        global $session;

        $updateid = intval($_REQUEST ['updateid']);
        $media_mod = new common ('need');
        $tag = array();
        if (submitcheck('commit')) {

            $data ['need_yijian'] = $_POST['need_yijian'];
            $data ['admin_ping'] = $_POST['admin_ping'];
            $data ['admin_ping_num'] = $_POST['admin_ping_num'];

            if ($updateid > 0) {
                if ($media_mod->UpdateData($data, 'and n_id=' . $updateid)) {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanxuqiu', 3, '修改成功', 'redirect', true);
                } else {
                    sheader('index.php?con=' . $GLOBALS ['setting'] ['adminpath'] . '&act=dangyuanxuqiu', 3, '修改失败', 'redirect', true);
                }
            }
        } else {
            if ($updateid) {
                $dangyuanxuqiu = $media_mod->GetOne('and n_id=' . $updateid);
            }
            include ROOT_PATH . '/views/admin/dangyuanxuqiu_form.php';
        }
    }


    //ajax修改添加处理
    function admin_ajax_action()
    {
        $key = empty ($_GET ['primarykey']) ? 'id' : $_GET ['primarykey'];

        if (empty ($_GET ['table'])) {
            echo '参数有误';
            exit ();
        } elseif (empty ($_GET ['field'])) {
            echo '字段为空';
            exit ();
        } elseif (intval($_GET ['primary']) == 0) {
            echo '主键不能为0';
            exit ();
        } else {
            $obj = new common ($_GET ['table']);

            $data [$_GET ['field']] = trim(strip_tags($_GET ['val']));
            $container = "and " . $key . "=" . intval($_GET ['primary']);
            $this->_cachedel();
            $goods = $obj->GetOne($container);

            if ($goods && $obj->UpdateData($data, $container, true)) {
                exit ('1');
            } else {
                exit ('failed');
            }
        }
    }

}